package cn.lk.gift.service.impl;

import cn.lk.gift.domain.Tenant;
import cn.lk.gift.mapper.TenantMapper;
import cn.lk.gift.query.TenantQuery;
import cn.lk.gift.service.ITenantService;
import cn.lk.gift.util.PageList;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lk
 * @since 2022-12-06
 */
@Service
public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> implements ITenantService {

    @Autowired
    private TenantMapper tenantMapper;
    @Override
    public PageList<Tenant> selectPageList(TenantQuery query) {
        //分页条件，查询出来总数
        Page<Tenant> page = new Page<>(query.getPage(),query.getRows());
        //跨表查询出来结构
        List<Tenant> datas =  tenantMapper.loadPageList(page,query);
        return new PageList<>(page.getTotal(),datas);
    }

}
